package classes.fire 
{
	/**
	 * ...
	 * @author fox
	 */
	import flash.display.*;
	
	import classes.GameSetting;
	
	public class StoneWall extends Sprite {
		private static  const UNIT:uint = 30;
		private static  const WIDTH:uint = 15;
		//private static  const HEIGHT:uint = 17;
		private var wallCls:Class;
		private var array:Array = new Array();

		private static  const WALL_DATA:Array = [
		1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
		1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
		1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
		1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
		1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
		1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
		1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
		1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
		1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
		1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
		1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
		1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
		1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
		1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
		1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
		1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
		0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
		0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];

		public function StoneWall() {			
			init();
		}
		private function init():void {
			wallCls=GameSetting.uiRsc.contentLoaderInfo.applicationDomain.getDefinition("HitWall") as Class;
			setWall();
		}
		private function setWall():void {			
			var row:uint;
			var col:uint;

			for (var i:uint=0; i<WALL_DATA.length; i++) {
				row = int(i/WIDTH);
				col = i - row*WIDTH;
				switch (WALL_DATA[i]) {
					case 1 :
						var brick:wallCls = new wallCls();
						brick.width = 30;
						brick.height = 30;
						//brick.x = (col) * 30 + GameSetting.OFFSETX;
						brick.x = (col) * 30;
						brick.y = (row) * 30 - UNIT*2;
						addChild(brick);
						break;
					case 0 :
						break;					
				}
			}
		}
	}
}